package com.dfbz.demo;

import java.util.HashSet;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo01_HashSet的特点 {

    public static void main(String[] args) {

        HashSet<Person> set =new HashSet<>();
        set.add(new Person("小灰",20));
        set.add(new Person("小灰",20));

        System.out.println(set.size());         // 2
    }



    public static void test(String[] args) {
        HashSet<String> set=new HashSet<>();
        set.add("湖北");
        set.add("河北");
        set.add(new String("河北"));

        System.out.println(set.size());            // 2
    }
}
class Person{
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Person() {
    }
}